var class_num=location.search;
class_num=class_num.split('?')[1];
$('header .title').append(class_num);
$('.card-courseware a').attr('href','file_courseware.html?'+class_num);
$('#href_index').attr('href','course.html?'+class_num);
$('#href_message').attr('href','message.html?'+class_num);
$('#me').attr('href','me.html?'+class_num);
if (islogin()) {

    $.post({
        url:'../../requests/student/select_courseware.php',
        data:{'class':class_num},
        success:function (data) {
            for (var i=0;i<data.length;i++){
                if (data[i].section != 0) {
                    var dom1="<li class='item-content'><div class='item-inner'>" +"<div class='item-title'><span>第</span><span>"+data[i].section+"</span><span>章</span></div>";
                }
                else dom1="";
                if (data[i].subsection != 0) {
                    var dom2="<div class='item-after'><span>第</span><span>"+data[i].subsection+"</span><span>节</span></div>"+"</div></li>";
                }
                else dom2="";
                var dom="<div class='list-block'><ul>" +

                    dom1+dom2+

                    "<li class='item-content'><div class='item-inner'>" +
                    "<div class='item-title'>"+data[i].name+"</div>"+
                    "</div></li>"+
                    "<li class='item-content'>" +
                    "<div class='item-inner'>" +
                    "<div class='item-after'><a href='../../"+data[i].attach+"'><span>下载</span><span class='icon icon-download'></span></a></div>"+
                    "</div>"+
                    "</li>"+
                    "</ul></div>";
                $('.content').append(dom);
            }
        }
    });

}
else window.location.href='../../index.html';